//
//  WBOriginalStatusView.swift
//  SinaMicroblog
//
//  Created by 原鹏飞 on 2017/4/13.
//  Copyright © 2017年 YuanPengFei. All rights reserved.
//

import UIKit

class WBOriginalStatusView: UIView {
    //懒加载属性: 微博正文的label
    lazy var statusLabel: UILabel = UILabel(title: nil)
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        //设置UI
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}


// MARK: - 设置UI
extension WBOriginalStatusView {
    func setupUI() {
        //0. 创建label
        var string = "苍井波多哦哦哦, 感觉自己蒙蒙的"
        let randomCount = arc4random() % 20 + 1  //获取1~20的随机数
        for _ in 0..<randomCount {
            string += "苍井波多哦哦哦, 感觉自己蒙蒙的"
        }
        statusLabel.text = string
        
        //1. 添加子视图
        self.addSubview(statusLabel)
        
        
        //2. 设置约束
        statusLabel.snp.makeConstraints { (make) in
            make.left.right.top.bottom.equalTo(self)
        }
        
        
    }
}
